#include<iostream>
#include<cstring>
using namespace std;
const int N = 10;
char map[N][N];
bool col[N], row[N];
bool st[N][N];
int n, k;
int cnt;
void dfs(int x, int y, int sum)
{
	if (sum > k) {
		return;
	}
	if (y == n) {
		x++;
		y = 0;
	}
	if (x == n) {
		if (sum == k) {
			cnt++;
		}
		return;
	}
	dfs(x, y + 1, sum);
	if (map[x][y] == '#' && !col[y] && !row[x]) {
		col[y] = row[x] = 1;
		dfs(x, y + 1, sum + 1);
		col[y] = row[x] = 0;
	}
}
int main()
{
	while (cin >> n >> k) {
		memset(st, 0, size(st));
		if (n == -1 && k == -1) {
			break;
		}
		cnt = 0;
		for (int i = 0; i < n; i++) {
			cin >> map[i];
		}
		dfs(0, 0, 0);
		cout << cnt << endl;
	}
	return 0;
}